package domain;

import java.util.Date;
import java.util.Objects;

/**
 * 社团公告类
 *
 * @author liujiale
 */
public class Announcement {

    /** 公告ID */
    private int announcementID;

    /** 发布者 */
    private ClubAdministrator publisher;

    /** 发布时间 */
    private Date publishTime;

    /** 内容 */
    private String content;

    /**
     * 空构造函数
     */
    public Announcement() {
    }

    /**
     * 构造函数
     *
     * @param announcementID 公告ID
     * @param publisher      发布者
     * @param publishTime    发布时间
     * @param content        公告内容
     */
    public Announcement(int announcementID, ClubAdministrator publisher, Date publishTime, String content) {
        this.announcementID = announcementID;
        this.publisher = publisher;
        this.publishTime = publishTime;
        this.content = content;
    }

    public Announcement(int announcementID, Date publishTime, String content) {
        this.announcementID = announcementID;
        this.publishTime = publishTime;
        this.content = content;
    }

    /**
     * Gets announcement id.
     *
     * @return the announcement id
     */
    public int getAnnouncementID() {
        return announcementID;
    }

    /**
     * Sets announcement id.
     *
     * @param announcementID the announcement id
     */
    public void setAnnouncementID(int announcementID) {
        this.announcementID = announcementID;
    }

    /**
     * Gets publisher.
     *
     * @return the publisher
     */
    public ClubAdministrator getPublisher() {
        return publisher;
    }

    /**
     * Sets publisher.
     *
     * @param publisher the publisher
     */
    public void setPublisher(ClubAdministrator publisher) {
        this.publisher = publisher;
    }

    /**
     * Gets publish time.
     *
     * @return the publish time
     */
    public Date getPublishTime() {
        return publishTime;
    }

    /**
     * Sets publish time.
     *
     * @param publishTime the publish time
     */
    public void setPublishTime(Date publishTime) {
        this.publishTime = publishTime;
    }

    /**
     * Gets content.
     *
     * @return the content
     */
    public String getContent() {
        return content;
    }

    /**
     * Sets content.
     *
     * @param content the content
     */
    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Announcement)) {
            return false;
        }
        Announcement that = (Announcement) o;
        return announcementID == that.announcementID && Objects.equals(publisher, that.publisher) && Objects.equals(publishTime, that.publishTime) && Objects.equals(content, that.content);
    }

    @Override
    public int hashCode() {
        return Objects.hash(announcementID, publisher, publishTime, content);
    }

    @Override
    public String toString() {
        return "Announcement{" +
                "announcementID=" + announcementID +
                ", publisher=" + publisher +
                ", publishTime=" + publishTime +
                ", content='" + content + '\'' +
                '}';
    }
}
